
************************************************************************************
**文章标题：Enterprise Computing Power Deployment, Data as a Production Factor and Digital Innovation: Causal Inference Based on Double Machine Learning

**文章作者：黄禧
**作者单位：广西壮族自治区信息中心


clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear



**************************************************************************************基准回归*****************************************************************************************
*************随机森林***控制一次项控制变量***************
**********不固定***********

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************随机森林***控制一次项控制变量****i.year***********

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust




*************随机森林***控制一次项控制变量*****i.id***i.year*******

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust




******************************************************************(二)稳健性检验*****************************************************************************************
**********(1)进一步控制城市、省份的时间趋势**********


*************随机森林***控制一次项控制变量******id year city*************

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id i.city
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************随机森林***控制一次项控制变量*****控制id year province*********

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id  i.province
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



*************随机森林***控制一次项控制变量*****控制id i.year#i.city**********

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id i.year#i.city 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



*************随机森林***控制一次项控制变量*****控制id i.year#i.province**********

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id   i.year#i.province
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



***************（2）更换核心被解释变量*******
clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear
**********不固定***********

global Y DIGI_R
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************随机森林***控制一次项控制变量****i.year***********

global Y DIGI_R
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

*************随机森林***控制一次项控制变量*****控制id**********

global Y DIGI_R
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************随机森林***控制一次项控制变量******控制id city********************

global Y DIGI_R
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id i.city
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************随机森林***控制一次项控制变量*****控制id ind city province**********

global Y DIGI_R
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id  i.province
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



******************************************************************(3)增加二次项控制变量**********************************************************
clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear
*************************************************************************00*************************************************

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age Size_sq Lev_sq ROA_sq CashFlow_sq Fixed_sq Growth_sq Board_sq Indep_sq Dual_sq Top1_sq BM_sq TQ_sq Age_sq 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

*************************************************************************year*************************************************

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age Size_sq Lev_sq ROA_sq CashFlow_sq Fixed_sq Growth_sq Board_sq Indep_sq Dual_sq Top1_sq BM_sq TQ_sq Age_sq i.year
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


**************************************************************************year id *************************************************

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age Size_sq Lev_sq ROA_sq CashFlow_sq Fixed_sq Growth_sq Board_sq Indep_sq Dual_sq Top1_sq BM_sq TQ_sq Age_sq i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



*****************************************id year city*******************

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age Size_sq Lev_sq ROA_sq CashFlow_sq Fixed_sq Growth_sq Board_sq Indep_sq Dual_sq Top1_sq BM_sq TQ_sq Age_sq i.year i.id i.city
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


******************************************id year city  province*********

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age Size_sq Lev_sq ROA_sq CashFlow_sq Fixed_sq Growth_sq Board_sq Indep_sq Dual_sq Top1_sq BM_sq TQ_sq Age_sq i.year i.id   i.province
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust




***********************************************************(4)重设机器学习模型*****************************************************
clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear

****改变双重机器学习模型的样本分割比例，由先前的 1 ∶ 4 改为 1 ∶ 2 ，探究样本分割比例对本文结论的可能影响； 

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(3)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



****改变双重机器学习模型的样本分割比例，由先前的 1 ∶ 4 改为 1 ∶ 5 ，

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(6)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


****改变双重机器学习模型的样本分割比例，由先前的 1 ∶ 4 改为 1 ∶ 6 ，

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(7)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*****************************调整重复训练次数*********************************

**************5次*********************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5) reps(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

**************10次*********************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5) reps(10)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



**************50次*********************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5) reps(50)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

******************************************************更换机器学习算法：套索模型**********************************************************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(lassocv) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(lassocv)
ddml crossfit
ddml estimate, robust

******************************************************更换机器学习算法：弹性网络模型**********************************************************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(elasticcv) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(elasticcv)
ddml crossfit
ddml estimate, robust

******************************************************更换机器学习算法：支持向量机模型**********************************************************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(svm) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(svm)
ddml crossfit
ddml estimate, robust


******************************************************更换机器学习算法：梯度提升**********************************************************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(gradboost) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(gradboost)
ddml crossfit
ddml estimate, robust

******************************************************更换机器学习算法：神经网络模型**********************************************************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(nnet) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(nnet)
ddml crossfit
ddml estimate, robust



*******************************进行交互式模型检验********************************基准回归中基于双重机器学习构建了部分线性模型进行分析，模型形式设定存在一定的主观性，本文采用双重机器学习构建更为一般性的交互式模型，探究模型设定对本文结论的影响，用于分析的主回归和辅助回归变更如下:**************** 
clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear


***随机森林**
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init interactive, kfolds(5)
ddml E[Y|X,D]: pystacked $Y $X, type(reg) method(rf)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

***套索模型**
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init interactive, kfolds(5)
ddml E[Y|X,D]: pystacked $Y $X, type(reg) method(lassocv)
ddml E[D|X]: pystacked $D $X, type(reg) method(lassocv)
ddml crossfit
ddml estimate, robust


***弹性网络模型**
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init interactive, kfolds(5)
ddml E[Y|X,D]: pystacked $Y $X, type(reg) method(elasticcv)
ddml E[D|X]: pystacked $D $X, type(reg) method(elasticcv)
ddml crossfit
ddml estimate, robust



***支持向量机**
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init interactive, kfolds(5)
ddml E[Y|X,D]: pystacked $Y $X, type(reg) method(svm)
ddml E[D|X]: pystacked $D $X, type(reg) method(svm)
ddml crossfit
ddml estimate, robust


***梯度提升**
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init interactive, kfolds(5)
ddml E[Y|X,D]: pystacked $Y $X, type(reg) method(gradboost)
ddml E[D|X]: pystacked $D $X, type(reg) method(gradboost)
ddml crossfit
ddml estimate, robust


***神经网络**
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init interactive, kfolds(5)
ddml E[Y|X,D]: pystacked $Y $X, type(reg) method(nnet)
ddml E[D|X]: pystacked $D $X, type(reg) method(nnet)
ddml crossfit
ddml estimate, robust





******************************************************（5）控制地区相关政策的影响**********************************************************
clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear

******************************************************智慧城市试点**********************************************************
global Y DIGI
global X 智慧城市试点 Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



******************************************************国家级大数据综合试验区**********************************************************
global Y DIGI
global X 国家级大数据综合试验区 Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

******************************************************公共数据开放**********************************************************
global Y DIGI
global X 公共数据开放  Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

******************************************************低碳城市试点**********************************************************
global Y DIGI
global X 低碳城市试点  Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
******************************************************大气污染控制区**********************************************************
global Y DIGI
global X 大气污染控制区 Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
  
******************************************************智慧城市试点  国家级大数据综合试验区 公共数据开放 低碳城市试点 大气污染控制区**********************************************************
global Y DIGI
global X 智慧城市试点   国家级大数据综合试验区 公共数据开放 低碳城市试点 大气污染控制区  Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

  

  
******（六）工具变量法：地形起伏*上一年互联网接入宽带接口
***set maxvar 允许调整 Stata 允许的最大变量数
clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear
***普通方法代码***
ivreghdfe DIGI (IDC = IV1) Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age, absorb(id year) cluster(id) first endog(IDC)
ivreghdfe DIGI (IDC = IV2) Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age, absorb(id year) cluster(id) first endog(IDC)



****机器学习工具变量法
*********IV1****************

global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id 
global D IDC
global Z IV1
set seed 42 
ddml init iv, kfolds(5)  
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf)
ddml E[Z|X]: pystacked $Z $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust 

*********IV2****************
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id 
global D IDC
global Z IV2
set seed 42 
ddml init iv, kfolds(5)  
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf)
ddml E[Z|X]: pystacked $Z $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust 



***********************根据上面计算结果可知采纳的是训练样本89，然后运用两阶段最小二乘法***************************
ivreg2 Y1_pystacked_89 (D1_pystacked_89 = Z1_pystacked_89),nocons robust first
ivreghdfe Y1_pystacked_1 ( D1_pystacked_1 = Z1_pystacked_1 ) ,nocons  absorb(id year ) cluster(id) first endog(D1_pystacked_1 )
***保留常数项结果比较好***
ivreg2 Y1_pystacked_1 ( D1_pystacked_1 = Z1_pystacked_1 ), robust first




*********************************************************机制检验**************************************************************************


clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear

  
***********************************************************数据资产化****************************************************************
global Y DIGA
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************************数据资产化lnDIG_asset_ziyong****************************
global Y DIGAown
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



*************************数据资产化lnDIG_asset_jiaoyi****************************
global Y DIGAtrate
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



*************************数字化知识积累***************************************
*************************吴非lnDIGITAL****************************
global Y lnDIGITAL 
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************************吴非lnAI****************************

global Y lnAI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

*************************吴非lnOTHER****************************
global Y lnOTHER
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust




*************************数据要素流动DATA_FLOW**********************************************
global Y DATA_FLOW
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*************************数据要素流动 DATA_FLOW1****************************
global Y DATA_FLOW1
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id 
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust

*************************数据要素流动 DATA_FLOW2****************************
global Y DATA_FLOW2
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age  i.year i.id  
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust








**********************************************************************异质性检验**********************************************************************

***set maxvar 允许调整 Stata 允许的最大变量数
clear all
***set maxvar 允许调整 Stata 允许的最大变量数
set maxvar 120000
***基准回归
cd D:\！！！！！论文资料\！！2025论文\算力部署、数据跨域流动与企业全要素生产率——来自智算中心的证据\！！模型验证
clear
use DATA.dta, clear
*****************************************地区异质性****************************************

*************数字基础设施指数01变量****************
clear
use  DATA.dta, clear
keep if inlist(数字基础设施指数01变量,1)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
*************数字基础设施指数01变量,0****************
clear
use  DATA.dta, clear
keep if inlist(数字基础设施指数01变量,0)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



******************数字化政策支持强度dig_reg_strength*******
*************数字化支持强度,1****************
clear
use  DATA.dta, clear
keep if inlist(dig_reg_strength,1)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
*************数字化支持强度,0****************
clear
use  DATA.dta, clear
keep if inlist(dig_reg_strength,0)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



****************************************进一步分析：地区政策协同******************
*******************环境规制强度*********

*******************环境规制强度：汇总算法*********
*************环境规制强度,1****************
clear
use  DATA.dta, clear
keep if inlist(regulation_dummy,1)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
*************环境规制强度,0****************
clear
use  DATA.dta, clear
keep if inlist(regulation_dummy,0)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



****************地区资源协同***********************
*************能耗压力EC_Pressure_group,1****************
clear
use  DATA.dta, clear
keep if inlist(EC_Pressure_group,1)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
*************能耗压力EC_Pressure_group,0****************
clear
use  DATA.dta, clear
keep if inlist(EC_Pressure_group,0)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust


*****************************************行业异质性**************************

*************技术密集型,1****************
clear
use  DATA.dta, clear
keep if inlist(技术密集型,1)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
*************技术密集型,0****************
clear
use  DATA.dta, clear
keep if inlist(技术密集型,0)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust




************************************************************************************************************新增******************************************************



*************高科技HighTech_1,1****************（可以用）
clear
use  DATA.dta, clear
keep if inlist(HighTech_1,1)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
*************高科技HighTech_1,0****************
clear
use  DATA.dta, clear
keep if inlist(HighTech_1,0)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
******************************************************************


*************资产密集型,1****************
clear
use  DATA.dta, clear
keep if inlist(资产密集型,1)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust
*************资产密集型,0****************
clear
use  DATA.dta, clear
keep if inlist(资产密集型,0)
global Y DIGI
global X Size Lev ROA CashFlow Fixed Growth Board Indep Dual Top1 BM TQ Age i.year i.id
global D IDC 
set seed 42 
ddml init partial, kfolds(5)
ddml E[D|X]: pystacked $D $X, type(reg) method(rf) 
ddml E[Y|X]: pystacked $Y $X, type(reg) method(rf)
ddml crossfit
ddml estimate, robust



















